import {
  Body,
  Controller,
  Injectable,
  Post,
  UseInterceptors,
} from '@nestjs/common';
import { TokenCreateDto } from '../dto/TokenCreateDto';
import { AuthService } from '../services/AuthService';
import { ResponseInterceptor, ResponseResult } from '../interceptor/response';

@Controller('token')
export class TokenController {
  constructor(private AuthService: AuthService) {}
  @UseInterceptors(ResponseInterceptor)
  @Post()
  async create(@Body() token: TokenCreateDto) {
    const tokenStr = await this.AuthService.createToken(token);
    return ResponseResult.Success(tokenStr, 'get token success');
  }
}
